<?php
//Begin include lib 2013-03-06
require_once('../lib/nusoap/nusoap.php');
include('../lib/log4php/Logger.php');
Logger::configure('../log/logconfig.xml');
include '../util/PrintArray.php';
// End include lib 2013-03-06
// Begin include custom class 2013-03-06
include '../operation/LoginOperation.php';
// End include custom class 2013-03-06

$namespace = "LoginWebService";
$server = new soap_server();
$server->configureWSDL('LoginWebService', 'urn:LoginWebService');
$server->wsdl->schemaTargetNamespace = $namespace;

// Begin Login Request Data Type 2013-03-06
$server->wsdl->addComplexType(
        'loginRequestHeader'
        ,'complexType'
        ,'struct'
        ,'all'
        ,''
        ,array(  
            'refId'  => array('name' => 'refId','type' => 'xsd:string'),
            'dateTime'  => array('name' => 'dateTime','type' => 'xsd:string')
        )
);

$server->wsdl->addComplexType(
        'loginRequestDetail'
        ,'complexType'
        ,'struct'
        ,'all'
        ,''
        ,array(  
            'username'  => array('name' => 'username','type' => 'xsd:string'),
            'password'  => array('name' => 'password','type' => 'xsd:string')
        )
);

$server->wsdl->addComplexType(
        'loginRequest'
        ,'complexType'
        ,'struct'
        ,'all'
        ,''
        ,array(
            'loginRequestHeader'=> array('name' => 'loginRequestHeader','type' => 'tns:loginRequestHeader'),
            'loginRequestDetail'  => array('name' => 'loginRequestDetail','type' => 'tns:loginRequestDetail')
        )
);

// End Login Request Data Type 2013-03-06
// Begin Login Response Data Type 2013-03-06
$server->wsdl->addComplexType(
        'loginResponseHeader'
        ,'complexType'
        ,'struct'
        ,'all'
        ,''
        ,array(  
            'refId'  => array('name' => 'refId','type' => 'xsd:string'),
            'dateTime'  => array('name' => 'dateTime','type' => 'xsd:string'),
            'responseCode'  => array('name' => 'responseCode','type' => 'xsd:string'),
            'responseDesc'  => array('name' => 'responseDesc','type' => 'xsd:string')
        )
);

$server->wsdl->addComplexType(
	'RoleList',
	'complexType',
	'struct',
	'all',
	'',
	array(
		'role' => array('name' => 'role', 'type' => 'xsd:string')
	)
);

$server->wsdl->addComplexType(
	'RoleArrayList',
	'complexType',
	'array',
	'',
	'SOAP-ENC:Array',
	array(),
	array(
		array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:RoleList[]')
	),
	'tns:RoleList'
);

$server->wsdl->addComplexType(
        'loginResponseDetail'
        ,'complexType'
        ,'struct'
        ,'all'
        ,''
        ,array(  
            'firstname'  => array('name' => 'firstname','type' => 'xsd:string'),
            'lastname'  => array('name' => 'lastname','type' => 'xsd:string'),
            'rolelist'  => array('name' => 'rolelist','type' => 'tns:RoleArrayList')
        )
);

$server->wsdl->addComplexType(
        'loginResponse'
        ,'complexType'
        ,'struct'
        ,'all'
        ,''
        ,array(
            'loginResponseHeader' => array('name' => 'loginResponseHeader','type' => 'tns:loginResponseHeader'),
            'loginResponseDetail'  => array('name' => 'loginResponseDetail','type' => 'tns:loginResponseDetail')
        )
);
// End Login Request Response Data Type 2013-03-06
// Begin Override Request Response Data Type 2013-03-17
$server->wsdl->addComplexType(
        'overrideRequestHeader'
        ,'complexType'
        ,'struct'
        ,'all'
        ,''
        ,array(
            'refId' => array('name' => 'refId','type' => 'xsd:string'),
            'dateTime' => array('name' => 'dateTime','type'=>'xsd:string')
        )
);

$server->wsdl->addComplexType(
        'overrideRequestDetail'
        ,'complexType'
        ,'struct'
        ,'all'
        ,''
        ,array(
            'overrideUserId' => array('name' => 'overrideUserId','type' => 'xsd:string'), 
            'overridePassword' => array('name' => 'overridePassword','type'=>'xsd:string')
        )
);

$server->wsdl->addComplexType(
        'overrideRequest'
        ,'complexType'
        ,'struct'
        ,'all'
        ,''
        ,array(
            'overrideRequestHeader' => array('name'=>'overrideRequestHeader','type'=>'tns:overrideRequestHeader'),
            'overrideRequestDetail' => array('name'=>'overrideRequestDetail','type'=>'tns:overrideRequestDetail')
        )
);

$server->wsdl->addComplexType(
        'overrideResponseHeader'
        ,'complexType'
        ,'struct'
        ,'all'
        ,''
        ,array(
            'refId'=>array('name'=>'refId','type'=>'xsd:string')
            ,'dateTime'=>array('name'=>'dateTime','type'=>'xsd:string')
            ,'responseCode'=>array('name'=>'responseCode','type'=>'xsd:string')
            ,'responseDesc'=>array('name'=>'responseDesc','type'=>'xsd:string')
        )
);

$server->wsdl->addComplexType(
	'OverrideRoleList',
	'complexType',
	'struct',
	'all',
	'',
	array(
		'overrideRole' => array('name' => 'overrideRole', 'type' => 'xsd:string')
	)
);

$server->wsdl->addComplexType(
	'OverrideRoleArrayList',
	'complexType',
	'array',
	'',
	'SOAP-ENC:Array',
	array(),
	array(
		array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:OverrideRoleList[]')
	),
	'tns:OverrideRoleList'
);

$server->wsdl->addComplexType(
        'overrideResponseDetail'
        ,'complexType'
        ,'struct'
        ,'all'
        ,''
        ,array(
            'refId'=>array('name'=>'refId','type'=>'xsd:string')
            ,'dateTime' => array('name'=>'dateTime','type'=>'xsd:string')
            ,'overrideRole'=>array('name'=>'overrideRole','type'=>'tns:OverrideRoleArrayList')
        )
);

$server->wsdl->addComplexType(
        'overrideResponse'
        ,'complexType'
        ,'struct'
        ,'all'
        ,''
        ,array(
            'overrideResponseHeader' => array('name'=>'overrideResponseHeader','type'=>'tns:overrideResponseHeader')
            ,'overrideResponseDetail' => array('name'=>'overrideResponseDetail','type'=>'tns:overrideResponseDetail')
        )
);
// End Override Request Response Data Type 2013-03-17 
// Begin Login Operation 2013-03-06
$server->register(
                'LoginOperation.login',     
                array('loginRequest'=>'tns:loginRequest'), 
                array('loginResponse'=>'tns:loginResponse'),
                $namespace,
                false,
                'rpc',
                'encoded',
                'LoginOperation'
);
// End Login Operation 2013-03-06
// Begin Override Operation 2013-03-17
$server->register(
        'LoginOperation.override'
        ,array('overrideRequest'=>'tns:overrideRequest')
        ,array('overrideResponse'=>'tns:overrideResponse')
        ,$namespace
        ,false
        ,'rpc'
        ,'encoded'
        ,'OverrideOperation'
);
// End Override Operation 2013-03-17

$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
exit();
?>
